//
//  ImageAndTextTableViewCell.m
//  YaDiuDiu
//
//  Created by 陈刚 on 2017/10/8.
//  Copyright © 2017年 jy. All rights reserved.
//

#import "ImageAndTextTableViewCell.h"

@implementation ImageAndTextTableViewCell

- (void)awakeFromNib {
    [super awakeFromNib];
    
    CAShapeLayer *border = [CAShapeLayer layer];
    // 线条颜色
    border.strokeColor = [UIColor grayColor].CGColor;
    border.fillColor = nil;
    border.path = [UIBezierPath bezierPathWithRect:self.bgView.bounds].CGPath;
    border.frame = self.bgView.bounds;
    // 不要设太大 不然看不出效果
    border.lineWidth = 1;
    border.lineCap = @"square";
    // 第一个是 线条长度 第二个是间距 nil时为实线
    border.lineDashPattern = @[@4, @4];
    [self.bgView.layer addSublayer:border];
    // Initialization code
}

- (void)layoutSubviews{
    [self.imageButton setImageEdgeInsets:UIEdgeInsetsMake(-30, 55, 0, 0)];
    [self.imageButton setTitleEdgeInsets:UIEdgeInsetsMake(30, -55, 0, 0)];
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

- (IBAction)imageEvent:(UIButton *)sender {
    self.addImageActionButton(sender);
}

- (IBAction)closeEvent:(UIButton *)sender {
    self.deleteImageActionButton(sender);
}

- (void)textViewDidChange:(UITextView *)textView{
    
    if (textView.markedTextRange == nil) {
        self.textChangeActionButton(textView);
    }
    
}
@end
